From: Christoph Egger Date: Mon, 17 Jan 2011 17:18:38 +0000 (+0000) Subject: libxl: fix guest networking on NetBSD X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10919 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=85b911622372484047c5fbb9dddf52022a265075;p=xen.git libxl: fix guest networking on NetBSD As previously reported when I start guests with xl then the guest network does not work because the qemu-ifup script no longer runs. NetBSD doesn't have something like udev. Changing xm/xend, libxl and xenbackendd to make everything behave the same way is a lot more intrusive than enabling it for NetBSD again. Signed-off-by: Christoph Egger Committed-by: Ian Jackson --- diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 6a34dcd4f1..878625253f 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -28,6 +28,15 @@ #include "libxl.h" #include "flexarray.h" +static const char *libxl_tapif_script(libxl__gc *gc) +{ +#ifdef __linux__ + return libxl__strdup(gc, "no"); +#else + return libxl__sprintf(gc, "%s/qemu-ifup", libxl_xen_script_dir_path()); +#endif +} + static char ** libxl_build_device_model_args_old(libxl__gc *gc, libxl_device_model_info *info, libxl_device_nic *vifs, @@ -129,8 +138,9 @@ static char ** libxl_build_device_model_args_old(libxl__gc *gc, flexarray_vappend(dm_args, "-net", libxl__sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s", vifs[i].devid, smac, vifs[i].model), - "-net", libxl__sprintf(gc, "tap,vlan=%d,ifname=%s,bridge=%s,script=no", - vifs[i].devid, ifname, vifs[i].bridge), NULL); + "-net", libxl__sprintf(gc, "tap,vlan=%d,ifname=%s,bridge=%s,script=%s", + vifs[i].devid, ifname, vifs[i].bridge, libxl_tapif_script(gc)), + NULL); ioemu_vifs++; } } @@ -261,8 +271,8 @@ static char ** libxl_build_device_model_args_new(libxl__gc *gc, flexarray_append(dm_args, libxl__sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s", vifs[i].devid, smac, vifs[i].model)); flexarray_append(dm_args, "-net"); - flexarray_append(dm_args, libxl__sprintf(gc, "tap,vlan=%d,ifname=%s,script=no", - vifs[i].devid, ifname)); + flexarray_append(dm_args, libxl__sprintf(gc, "tap,vlan=%d,ifname=%s,script=%s", + vifs[i].devid, ifname, libxl_tapif_script(gc))); ioemu_vifs++; } }